In the last video we created a price chart with the Levin sector indexes.
And from that chart we could say that the customer services index here in red.
So the highest return however is pretty impossible to compare these indexes here based on risk return
performance and therefore in a first step we are going to calculate the annualized risk and return based
on daily simple returns.
And then we create an appropriate plot.
And finally we also calculate the sharp ratio and we compare Mary's portfolio with the other indexes
in terms of Sharpe ratio and we we're still important here.
The indexes data frame and with the percentage change method we can simply calculate a simple daily
returns and we save for those returns.
And the variable returns
and from the video lectures we also copy to the user defined function annualized the risk and return
we have we simply have to pass a returns data frame.
So let's define the function here and let's pass our returns that frame and be safe.
The resulting summary data frame and the variable summary
so here we have the annualized the risk and return for the eleven industries for the most recent four
year period.
And still the performance of our health care index is pretty impressive.
So on average we had a annual return of 14 percent.
And finally we can also plot our 11 industries as scatter plot where we f on the x axis the total risk
here and on the y axis the annualized return.
So we you see the plot method and we select a scatter plot and we pass uh the risk column to the experimenter
and the return column to the right parameter.
And we also annotate the points for the thoughts that we create with the respect the label here.
So capital goods or energy finance and let's simply run here the cell.
So that's the total risk return plot.
And here we have actually our health care index.
And it's pretty good actually because it is desire to have low risk and high return.
So it's a desire to be here on the upper left corner and the health care index is pretty much here.
So compared to other industries like basic industries transportation finance or energy.
And to be on the safe side and to be even more exact we have to calculate the shop ratio and the father
shop ratio we need the risk free return of the risk free asset and for the period from 214 to till 80
in the coupon for a four year U.S. government bond was approximately one point three percent.
So we say here a list with the risk free return and the risk free risk and the RAB risk free and with
this we can finally calculate the sharp ratio for our eleven indexes and we are creating the new column
sharp and we can actually calculate the sharp ratio by taking the returns off our indexes minus the
risk free return and then divide by the risk of the respective indexes.
So with this we created the new column sharp and we can also sort our rows by the shop raised through
all by the column sharp in a descending order.
So starting from the industry or the index with the highest chop ratio so let's have a look here and
obviously so healthcare is on the second position with the second highest chop ratio here 0 point 8
7 8.
And that's actually only one index or one sector with a higher shop ratio.
And this is the consumer services sector.
And here we have actually a sharp ratio of one point to 7 1.
And finally here at the bottom we have the energy sector with a sharp ratio of only 0 point 1 5 8 so
the health care sector and the marriage portfolio performed uh pretty good on a standalone basis in
the recent past.
So in the last four years.
But the question is whether Mary could have improved the sharp ratio of her portfolio by adding other
sectors.
So that's the question for us step 6.
And I hope to see also there by.